#!/bin/bash
# WORKINGDIR=$(cd `dirname $0`; pwd)
# FILTERSTR=`echo $WORKINGDIR | awk -F '/' '{print $(NF-1)}'`
FILTERSTR="UK"
if [ $# -gt 1 ];then
    
      echo "第一种用法,不带参数,显示所有的 $FILTERSTR 进程的运行时间"
      echo "第二种用法,带参数,显示所有的 $FILTERSTR 进程 中过滤指定名称后的进程的运行时间"
      echo "第三种用法,没有哦!!!"
      exit 0
    
fi   

if [ $# -eq 1 ];then
      echo  -e "\e[1;31m ps -A -opid,stime,etime,args|head -n 1;ps -A -opid,stime,etime,args |grep -v grep  | grep $FILTERSTR| grep -w $1 \e[0m"
      ps -A -opid,stime,etime,args | head -n 1;ps -A -opid,stime,etime,args | grep -v grep  | grep $FILTERSTR| grep -w $1 --color=auto
else
      echo  -e "\e[1;31m ps -A -opid,stime,etime,args|head -n 1;ps -A -opid,stime,etime,args  |grep -v grep | grep $FILTERSTR \e[0m"
      ps -A -opid,stime,etime,args | head -n 1;ps -A -opid,stime,etime,args | grep -v grep | grep $FILTERSTR  --color=auto
#       ps -A -opid,stime,etime,args | head -n 1;ps -A -opid,stime,etime,args | grep -v grep | grep "UK"  --color=auto
fi

